package uit.bus;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

import com.google.android.maps.MapView;

public class ThongTinTuyenCT extends Activity {

	public TextView matuyen;
	public TextView tentuyen;
	public TextView luotdi;
	public TextView luotve;
	public TextView ttkhac;
	public TextView dvdamnhan;
	public int idmatuyen;
	public DBAdapter db;
	public int state = 0;
	public MapView map;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tttuyenct);

		matuyen = (TextView) findViewById(R.id.matuyen);
		tentuyen = (TextView) findViewById(R.id.tentuyen);
		luotdi = (TextView) findViewById(R.id.luotdi);
		luotve = (TextView) findViewById(R.id.luotve);
		ttkhac = (TextView) findViewById(R.id.ttkhac);
		dvdamnhan = (TextView) findViewById(R.id.dvdamnhan);

		Bundle extra = getIntent().getExtras();
		if (extra != null) {
			idmatuyen = extra.getInt("matuyen");
			display(idmatuyen);
		}
	}

	public void display(int masotuyen) {
		db = new DBAdapter(this);
		db.open();
		Cursor mycursor = db.getTuyenCT(masotuyen);
		if (mycursor.moveToFirst()) {
			matuyen.setText(Html.fromHtml("<font color='#CD7F32'>"
					+ "Mã Tuyến : " + "</font>"));
			matuyen.append(String.valueOf(mycursor.getInt(0)));
			tentuyen.setText(Html.fromHtml("<font color='#CD7F32'>"
					+ "Tên Tuyến : " + "</font>"));
			tentuyen.append(mycursor.getString(1));
			luotdi.setText(Html.fromHtml("<i><font color='#CD7F32'>"
					+ "Lượt đi : " + "</font></i>"));
			luotdi.append(mycursor.getString(3));
			luotve.setText(Html.fromHtml("<i><font color='#CD7F32'>"
					+ "Lượt về : " + "</font></i>"));
			luotve.append(mycursor.getString(4));
			ttkhac.setText(mycursor.getString(5));
			dvdamnhan.setText(Html.fromHtml("<font color='#CD7F32'>"
					+ "Đơn vị đảm nhận : " + "</font>"));
			dvdamnhan.append(mycursor.getString(6));
		}

	}
}
